package com.niiwoo.civet.trade.service.dubbo.newRefund;

import com.alibaba.dubbo.config.annotation.Service;
import com.niiwoo.civet.trade.service.local.newRefund.notify.RefundWarnMsgService;
import com.niiwoo.civet.trade.service.local.newRefund.refundDeal.core.RefundNotifyRecordHandleService;
import com.niiwoo.civet.trade.service.newRefund.RefundNotifyExceptionDubboServce;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

@Slf4j
@Service(version = "1.0.0")
public class RefundNotifyExceptionDubboServceImpl implements RefundNotifyExceptionDubboServce {
	
	@Autowired
	private RefundNotifyRecordHandleService refundNotifyRecordHandleService;
	@Autowired
	private RefundWarnMsgService refundWarnMsgService;
	
	@Override
	public void compensationHandle() {
		try {
			refundNotifyRecordHandleService.compensationHandle();
		} catch (Exception e) {
			log.error("还款消息补偿流程-重新发送待处理消息任务异常，异常原因：{}", e.getMessage(), e);
		}
	}
	
	@Override
	public void clearHandledRecordByExceedDay(Integer exceedDay) {
		try {
			refundNotifyRecordHandleService.clearHandledRecordByExceedDay(exceedDay);
		} catch (Exception e) {
			log.error("还款消息补偿流程-定时清除已处理的异常消息任务异常，异常原因：{}", e.getMessage(), e);		
		}
	}

	@Override
	public void sendMessageForRefund(){
		refundWarnMsgService.sendMessageForRefund();
	}
}